﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QLDV.Models;
using System.Web.Mvc;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;


namespace QLDV.ViewModels
{
    public class CSDModel
    {
        [HiddenInput(DisplayValue=false)]
        public int? Id { get; set; }

        [DisplayName("Tên")]
        [Required(ErrorMessage = "Vui lòng nhập tên cơ sở đoàn")]
        [StringLength(30)]
        public string Ten { get; set; }

        [DisplayName("Tên")]
        [DataType(DataType.MultilineText)]
        public string MoTa { get; set; }

        public int? Id_LoaiCSD { get; set; }
        public int? Id_CSDQL { get; set; }
        public string SoQDTL { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime? NgayThanhLap { get; set; }

        public CSDModel(CSD csd)
        {
            Id = csd.Id_CSD;
            Ten = csd.Ten;
            MoTa = csd.MoTa;
            Id_CSDQL = csd.Id_CSDQL;
            Id_LoaiCSD = csd.Id_LoaiCSD;
            SoQDTL = csd.SoQDTL;
            NgayThanhLap = csd.NgayThanhLap;

        }
        public CSDModel()
        {
            Id = null;
        }
        public CSD returnCSD()
        {
            return new CSD
            {
                Ten = this.Ten,
                MoTa = this.MoTa,
                Id_CSDQL = this.Id_CSDQL,
                Id_LoaiCSD = this.Id_LoaiCSD,
                SoQDTL = this.SoQDTL,
                NgayThanhLap = this.NgayThanhLap
            };
        }

    }
}